import { useState, useRef } from 'react';

export default function OnChangeVal() {
  const [inputVal, setInputVal] = useState('')
  const inputRef = useRef(null)
  const handleShowRefDom = () => {
    console.dir(inputRef.current)
  }
  return (
    <div>
      <span onClick={handleShowRefDom}>{inputVal}</span>
      <input 
        ref={inputRef}
        value={inputVal}
        onChange={(e) => setInputVal(e.target.value)}
      />
    </div>
  )
}